<template>
  <el-checkbox-group class="z-checkbox-group">
    <el-checkbox
      v-for="item in items"
      :value="item[props?.value || 'id']"
      :disabled="item[props?.disabled || 'disabled']"
      :border="border"
      >{{ $t(item) }}</el-checkbox
    >
  </el-checkbox-group>
</template>

<script lang="ts" setup>
import { useI18n } from 'vue-i18n'

const PROPS = withDefaults(
  defineProps<{
    items?: AnyObject[]
    props?: AnyObject
    border?: boolean
    i18n?: boolean
    i18nPrefix?: string
  }>(),
  {
    items: () => []
  }
)
const { t } = useI18n()
const $t = (item: AnyObject) => {
  const props = PROPS.props
  const label = item[props?.label || 'name']
  const mult = item[props?.mult || 'mult']
  return PROPS.i18n && mult ? t((PROPS.i18nPrefix ? PROPS.i18nPrefix + '.' : '') + mult) : label
}
</script>

<style lang="scss"></style>
